<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>
<body>
    <div id="app">
        {{message}}
        <com-a></com-a>
        <com-a></com-a>
        <com-a></com-a>
    </div>
    <template id="coma">
        <div>
            <h1>我是coma组件{{name}}</h1>
            <button @click="changename">点击我修改name的值</button>
        </div>
        
    </template>
    <script>
        // 组件是提高复用性
        // let obj = {
        //     name:"张三"
        // }
        let ComA = {
            template:"#coma",
            data:function(){
                return {
                    name:"张三"
                };
            },
            methods:{
                changename(){
                    this.name = "李四"
                }
            }
        }

        new Vue({
            el:"#app",
            components:{
                ComA
            },
            data:function(){
                return {
                    message:"数据"
                }
            }
        })



    </script>
</body>
</html>